FTabControl := GetComponent(Application.MainForm, STabControl, SGenericError + STabControl) as TTabControl;
FPalettePopup := GetComponent(Application.MainForm, SPaletteMenu, SGenericError + SPaletteMenu) as TPopupMenu;
end;
destructor TIvoryHacker.Destroy;
begin
//Get rid of registry object
Ini.Free;
//If someone made an options menu, then get rid of it
FOptions.Free;
inherited Destroy
end;
procedure TIvoryHacker.DoAbout(Sender: TObject);
//Code to extract program version an file
//version from the current binary file
function VersionNumber: String;
var
VerInfo: Pointer;
Len, BufSize: Integer;
Dest: PChar;
DestCodeInfo: ^LongRec;
LangCharSet: String;
FileName: array[0..Max_Path] of Char;
begin
Result := '';
//Find current binary file name
GetModuleFileName(HInstance, FileName, Max_Path);
//How big is version info?
BufSize := GetFileVersionInfoSize(FileName, Len);
if BufSize > 0 then
begin
//Reserve sufficient memory
GetMem(VerInfo, BufSize);
try
//Get version information if GetFileVersionInfo(FileName, 0, BufSize, VerInfo) then begin //Get translation table if VerQueryValue(VerInfo, '\VarFileInfo\Translation', Pointer(DestCodeInfo), Len) and (Len >= 4) then { Translation table exists} LangCharSet := Format('\StringFileInfo\%.4x%.4x\', [DestCodeInfo^.Lo, DestCodeInfo^.Hi]); //Get ver. info. value via translation table if VerQueryValue(VerInfo, PChar(LangCharSet + 'ProductVersion'), Pointer(Dest), Len) then AppendStr(Result, 'Version ' + StrPas(Dest)); //Get ver. info. value via translation table if VerQueryValue(VerInfo, PChar(LangCharSet + 'FileVersion'), Pointer(Dest), Len) then AppendStr(Result, ' (Build ' + StrPas(Dest) + ')'); end finally //Free sufficient memory FreeMem(VerInfo, BufSize); end end
end;
begin
//Would normally use MessageDlg, but I
//want to customise the icon, so use
//the more primitive CreateMessageDialog
with CreateMessageDialog(SAboutMsg + VersionNumber, mtInformation, [mbOk]) do
try
(FindComponent(SImage) as TImage).Picture.Icon.Handle :=